// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import 'styles/base/reset.css'
import 'styles/base/border.css'
import 'styles/iconfont/iconfont.css'
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'
import 'mavon-editor/dist/css/index.css'
import { Notification, Input } from 'element-ui'
import App from './App'
import router from './router'
import './utils/nprogress.js'
import './icons'
import animate from 'animate.css'
import store from './store'
import BootstrapVue from 'bootstrap-vue'
import VueLazyload from 'vue-lazyload'
import Meta from 'vue-meta'
import mavonEditor from 'mavon-editor'

Vue.config.productionTip = false
Vue.use(animate)
Vue.use(BootstrapVue)
Vue.use(mavonEditor)
Vue.use(Meta)
Vue.component(Notification.name, Notification)
Vue.component(Input.name, Input)
Vue.prototype.$notify = Notification
// 最外层static目录下的图片引用
Vue.use(VueLazyload, {
  error: './static/image/404.png', // 图片加载失败时候显示的图片
  loading: './static/image/loading.gif' // 图片还未加载完成时候的loading图片
})

// 跳转页面返回到顶部
router.afterEach((to, from, next) => {
  window.scrollTo(0, 0)
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  store,
  router,
  components: { App },
  template: '<App/>',
  /* 这句非常重要，否则预渲染将不会启动 */
  mounted () {
    document.dispatchEvent(new Event('render-event'))
  }
})
